/**
 * 分类模块接口文件
 */

import { IPage, IPageResult } from './common';
import axios from './request';

/**
 * 分类接口
 */
export interface IPicture {
    id: number;
    name: string;
    user_id: number;
    create_date: Date;
}

/**
 * 搜索接口
 */
export interface ISearch extends IPage {
    start_date?: Date;
    end_date?: Date;
}

/**
 * 获取所有
 * @returns 
 */
export const getAll = async (model: ISearch): Promise<IPageResult<IPicture>> => axios.get('/picture/get', { params: model });

/**
 * 上传图片
 * @param model 
 * @returns 
 */
export const add = async (pictures: FormData[]) => axios.post('/picture/add', pictures);

/**
 * 删除
 * @param id 
 * @returns 
 */
export const del = async (id: number) => axios.delete('/picture/delete/' + id);